<?php declare(strict_types=1);


namespace App\Http\Controller;

use App\Rpc\Lib\OrderInterface;
use Exception;
use Swoft\Http\Server\Annotation\Mapping\Controller;
use Swoft\Http\Server\Annotation\Mapping\RequestMapping;
use Six\Rpc\Client\Annotation\Mapping\Reference;
/**
 * Class RpcController
 *
 * @since 2.0
 * @Controller(prefix="/rpc")
 */
class RpcController
{

    /**
     * @Reference(pool="order.pool",version="1.0",fallback="orderFallback")
     *
     * @var OrderInterface
     */
    private $orderService;



    /**
     * @RequestMapping("order")
     *
     * @return array
     */
    public function order():array
    {
        $result = $this->orderService->update();
        return [$result];
        
    }


    /**
     * @RequestMapping()
     *
     * @return array
     *
     * @throws Exception
     */
    public function exception(): array
    {
        $this->orderService->exception();

        return ['exception'];
    }
}